package com.sh.data.engine.common.enumDefinition;

import lombok.Getter;

@Getter
public enum ProjectStatisticTypeEnum {
    REGISTER_DS(1, -1, "已注册数据源", "datasource"),
    INDEX(2, -1, "已创建指标", "index"),
    INTEGRATE_TASK_OFFLINE(3, 1, "数据集成-离线", "integrateOffline"),
    INTEGRATE_TASK_ONLINE(3, 2, "数据集成-实时", "integrateOnline"),
    INTEGRATE_TASK_API(3, 3, "数据集成-接口采集", "integrateApi"),
    USER(4, -1, "成员数量", "user"),
    TABLE(5, -1, "已创建数据表", "table"),
    API(6, -1, "已创建API", "api"),
    DEVELOP_TASK_OFFLINE(7, 1, "数据开发-离线", "dataDevOffline"),
    DEVELOP_TASK_ONLINE(7, 2, "数据开发-实时", "dataDevOnline");


    private final String description;
    private final String type;
    private final Integer secondaryClassification;
    private final Integer primaryClassification;

    ProjectStatisticTypeEnum(Integer primaryClassification, Integer secondaryClassification, String description, String type) {
        this.primaryClassification = primaryClassification;
        this.secondaryClassification = secondaryClassification;
        this.description = description;
        this.type = type;
    }

    public static ProjectStatisticTypeEnum fromStatus(Integer primaryClassification, Integer secondaryClassification) {
        for (ProjectStatisticTypeEnum typeEnum : ProjectStatisticTypeEnum.values()) {
            if (typeEnum.getPrimaryClassification().equals(primaryClassification) && typeEnum.getSecondaryClassification().equals(secondaryClassification)) {
                return typeEnum;
            }
        }
        return null;
    }
}
